package com.xyh.service;

import com.xyh.dao.PersonDao;
import com.xyh.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.List;

@Service
public class PersonService {
    @Autowired
    private PersonDao personDao;
    //内置的查询
    public List<Person> getPersion(){
     return   personDao.findAll();
    }
    //自定义的查询
    public List<Person> myQuery(){
        return personDao.myQuery();
    }
    //根据名称查询
    public List<Person> name(String name){
        return  personDao.name(name);
    }
    //findby查询
    public List<Person> nameAndAge(String name,Integer age){
        return  personDao.findByNameAndAge(name,age);
    }
    //findby查询
    public List<Person> ageLessThan(Integer age){
      return personDao.findByAgeLessThan(age);
    }
    // 语句注入查询
    public List<Person> findPersionName(String name){
        return personDao.findPersionName(name);
    }
    // 语句注入查询
    public List<Person> findNativeName(String name){
        return personDao.findNativeName(name);
    }
}
